/*
 ============================================================================
 Name        : MaxTwo.c
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>
int ab[100];
void swap(int *, int *);
void find(int *, int, int);
int main(void) {
	int index, out;
	for (index = 0; index < 100; index++)
		ab[index] = index;
	find(ab, 0, 99);
	for (out = 0; out < 100; out++) {
		printf("%d", ab[out]);
	}
	return 0;
}
void swap(int *a, int *b) {
	int k = 0;
	int *mid = &k; //注意定义mid为指针时，要对其进行初始化操作，分配地址。
	*mid = *a;
	*a = *b;
	*b = *mid;
}

void find(int *arr, int x1, int x2) {
	int index;
	x1 = 0;
	x2 = 1;
	if (arr[x1] < arr[x2])
		swap(&x1, &x2);
	for (index = 2; index < 100; index++) {
		if (arr[x2] < arr[index])
			if (arr[x1] < arr[x2 = index])
				swap(&x1, &x2);
	}
	printf("%d %d", arr[x1], arr[x2]);
}
